﻿using StrategyPattern.Caculation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StrategyPattern
{
    /// <summary>
    /// 使用策略的主题  具体的需求
    /// </summary>
    internal class Context
    {
        //执行运算需要的数据（两个操作数  策略对象）
        private int inputLeft, inputRight;
        private BaseCaculation baseCaculation;

        public Context(int inputLeft, int inputRight, BaseCaculation baseCaculation)
        {
            this.inputLeft = inputLeft;
            this.inputRight = inputRight;
            this.baseCaculation = baseCaculation;
        }

        //执行运算的行为
        public int Caculation()
        {
            Console.WriteLine("正在使用策略进行运算......");
            return baseCaculation.Caculation(inputLeft, inputRight);

        }
    }
}
